<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no, email=no">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="640">
<meta name="screen-orientation" content="portrait">
<meta name="x5-orientation" content="portrait">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<meta name="browsermode" content="application">
<meta name="x5-page-mode" content="app">
<meta name="msapplication-tap-highlight" content="no">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta charset="utf-8">
<title>幸运大转盘</title>
<link rel="stylesheet" href="__ASSETS__/turntable/css/style.css" type="text/css" />
<script type="text/javascript" src="__ASSETS__/turntable/js/jquery.min.js"></script>
<script type="text/javascript" src="http://static.ilongyuan.cn/cdn/script/angular.min.js"></script>
<script type="text/javascript" src="__ASSETS__/turntable/js/awardRotate.js"></script>
<script type="text/javascript" src="__ASSETS__/turntable/js/jquery_public.js"></script>
<script type="text/javascript">
	{:C('GLOBAL_BDHM')}
</script>
<script type="text/javascript">
$(function (){
	var app = angular.module("myApp",[]);
	function loader(app){
		var appToken = '';// '8213070492436998cefb305ef10f1b5f';
		var consoleId = getQueryString("appToken");	
		if(consoleId != null && consoleId != ""){
			appToken = consoleId;
		}
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if (r != null && r != "") return unescape(r[2]); return null;
			
		}
		app.controller("controllerl",function($scope,$http){
		
			$scope.isLogin = 0;
			$scope.appToken_str = appToken;
		
			$http.get("/App/AjaxTtable/getWinners").success(function(response){
				for(var i=0;i<response.data.lists.length;i++){
					var Pro = response.data.lists[i];
					response.data.lists[i]["prize"] = prize[Pro.prize-1][1];
				}
				$scope.names = response.data.lists;
			});
			$http.get("/App/AjaxTtable/info?appToken="+appToken).success(function(response){
				console.log($scope.isLogin);
				if(response.status == 1){
					$scope.isLogin = 1;
					console.log($scope.isLogin);
					$scope.items = response.data;	
					 
					var num = response.data.times;//默认抽奖机会
					//var num = 2;//默认抽奖机会
					$(".setNum").text(num);
					if(num == 0){$(".cursorNoNum").show();}
					 
					$(".cursorNoNum").click(function(){
						alert("对不起！\n抽奖机会已用完~");
					});
					$scope.fontName = function(){
						if ($scope.isLogin == 0){
							return;
						}
						num--;
						if(num>=0){
							$(".cursorNo").show();
							$(".setNum").text(num); 
						}
						if(num>0){
							$(".cursorNoNum").hide();
						}else{
							$(".cursorNoNum").show();
						}
						$http.get("/App/AjaxTtable/action?appToken="+appToken).success(function(response){
							rndNum = response.data.prize;
							var item = rnd(rndNum,rndNum);//中哪些奖
							switch (item) {
								case 1://中奖率
									rotateFn(1, 150, '1');
									break;
								case 2:
									rotateFn(2, 90, '2');
									break;
								case 3:
									rotateFn(3, 30, '3');
									break;
								case 4:
									rotateFn(4, 330, '4');
									break;
								case 5:
									rotateFn(5, 270, '5');
									break;
								case 6:
									rotateFn(6, 210, '6');
									break;
							}
							console.log(item);
						});
				
					}
					
				}else if(response.status == -1){
					$(".lootery_lp").fadeIn(0);
					var prizeNum = response.data.prize-1;
					$(".lotteryNumber").html(prize[prizeNum][1]);
					$(".lotteryName").html(prize[prizeNum][2]);
				}else{
					alert(response.info);
				}
					
			});
		});
	}
	loader(app);
		
	var prize = [
		['1','一等奖','iPhone6s'],
		['2','二等奖','机械键盘'],
		['3','三等奖','虚拟货币'],
		['4','四等奖','500积分'],
		['5','五等奖','100积分'],
		['6','五等奖','安慰奖']
	]
	var rotateTimeOut = function (){
		$('#rotate').rotate({
			angle:0,
			animateTo:2190,
			duration:80,
			callback:function (){
				alert('网络超时，请检查您的网络设置！');
			}
		});9
	};
	var bRotate = false;

	var rotateFn = function (awards, angles, txt){
		bRotate = !bRotate;
		$('#rotate').stopRotate();
		$('#rotate').rotate({
			angle:0,
			animateTo:angles+930,//转动位置
			duration:8000,
			callback:function (){

				$('.lotteryPre').html("恭喜你中了");
				if(txt==prize[0][0]){
					$(".lotteryNumber").html(prize[0][1]);
					$(".lotteryName").html(prize[0][2]);
					$(".lootery_lp").fadeIn(0);
				}else if(txt==prize[1][0]){
					$(".lotteryNumber").html(prize[1][1]);
					$(".lotteryName").html(prize[1][2]);
					$(".lootery_lp").fadeIn(0);
				}else if(txt==prize[2][0]){
					$(".lotteryNumber").html(prize[2][1]);
					$(".lotteryName").html(prize[2][2]);
					$(".lootery_lp").fadeIn(0);
				}else if(txt==prize[3][0]){
					$(".lotteryNumber").html(prize[3][1]);
					$(".lotteryName").html(prize[3][2]);
					$(".lootery_no1").fadeIn(0);
				}else if(txt==prize[4][0]){
					$(".lotteryNumber").html(prize[4][1]);
					$(".lotteryName").html(prize[4][2]);
					$(".lootery_no1").fadeIn(0);
				}else if(txt==prize[5][0]){
					$(".lotteryNumber").html(prize[5][1]);
					$(".lotteryName").html(prize[5][2]);
					$(".lootery_no").fadeIn(0);
				}
				
				bRotate = !bRotate;
			}
		})
	};
	
	window.addEventListener('load', function(){

		ai.hideUrl();

		var bar_list_div = ai.i("bar_list_div"),

			bar_list     = ai.i("bar_list"),

			minus        = ai.ovb.ios() && ai.ovb.safari() && !ai.ovb.ipad() ? -20 : 0,

			up_arrow	 = ai.i("up_arrow"),

			up_text      = ai.i("up_text"),

			bar_list_ul  = ai.i("bar_list_ul");

			up_ing       = false,

		  down_ing       = false;

		bar_list.style.height =  ai.wh() - minus +"px";
		function update() {

			if(this.xy > 10 && up_ing == false){

				up_ing = true;

				down_ing = false;

				up_arrow.style['webkitTransitionDuration'] = '300ms';	

				up_arrow.style['webkitTransform'] = 'rotate(-180deg)';

				up_text.innerHTML = "松开即可刷新";

				this.up_range = 0;

			}else if(this.xy < 10 && down_ing == false){

				down_ing = true;

				up_ing = false;

				up_arrow.style['webkitTransitionDuration'] = '300ms';	

				up_arrow.style['webkitTransform'] = 'rotate(0deg)';

				up_text.innerHTML = "下拉刷新";

				this.up_range = 60;

			}

		}

		function loading() {

			if(this.up_range == 0){

				var that = this;

				up_text.innerHTML= 'Loading...';

				up_arrow.style['webkitTransitionDuration'] = '0ms';	

				up_arrow.className += ' loading';

				setTimeout(function () {
					//var newli = '';
					//var bar_list_ul_html = bar_list_ul.innerHTML;
					//bar_list_ul.innerHTML = newli + bar_list_ul_html;
					up_arrow.style['webkitTransform'] = 'rotate(0deg)';
					up_arrow.className = 'up_down_arrow';
					//loader(app);
					window.location.reload();
					that.up_range = 60;
					that.refresh();
				}, 1000);

			}

		}

		var slipjs_yuxiang = slip('px', bar_list_div, {

				up_range: 60,

				 moveFun: update,

				  endFun: loading

			});

	});
	
	
});
function rnd(n, m){
	return Math.floor(Math.random()*(m-n+1)+n)
}
</script>
<script src="__ASSETS__/turntable/js/fakeLoader.min.js"></script>
</head>
<body id="bar_list" ng-app="myApp" ng-controller="controllerl">
<div class="lodingBox"></div>
<div class="" id="bar_list_div">
	<div class="up_down"><div id="up_arrow" class="up_down_arrow"></div><div id="up_text" class="up_down_text">下拉刷新</div></div>
	<ul id="bar_list_ul">
        <li>
			<div class="shareBt"><img src="__ASSETS__/turntable/images/shareBt.png"></div>
			<div class="shareBox">
				<div class="box">
					<div class="tt"><img src="__ASSETS__/turntable/images/share_tt.png"></div>
					<div class="list">
						<div class="tt_txt"><div class="st1">中奖人</div><div class="st2">奖品</div><div class="st3">手机号</div></div>
						<div class="txtList">
							<div class="txt_list">
								<div class="shareList" ng-repeat="x in names"><div class="st1">{{x.nickname}}</div><div class="st2">{{x.prize}}</div><div class="st3">{{x.mobile}}</div></div>
							</div>
						</div>
					</div>
				</div>
				<div class="share_close"><a href="javascript:void(0)"><img src="__ASSETS__/turntable/images/bt2.png"></a></div>
			</div>
			<div class="content_box" id="bar_list_ul">
				<div class="hd_box">
				<span>亲爱的用户，您目前拥有 <b class="setNum">{{items.times}}</b> 次抽奖机会，成功分享给其他小伙伴并邀请其注册账号将额外获得 <b>{{items.plus}}</b> 次抽奖机会。</span>
				<font><a href="javascript:void(0)" class="share_bt"><img src="__ASSETS__/turntable/images/bt.png"></a></font>
				</div>
				<div class="turntable_bg">
					<div class="cursorNo"></div><div class="cursorNoNum"></div>
					<div class="pointer" ng-click="fontName()"><img src="__ASSETS__/turntable/images/pointer.png"/></div>
					<div class="rotate_ov"><div class="rotate"><img id="rotate" src="__ASSETS__/turntable/images/turntable2.png"/></div></div>
					<div class="bg"><img id="rotate" src="__ASSETS__/turntable/images/turntable2_bg.png"/></div>
				</div>
			</div>
			<div class="div_tan lootery_no">
				<div class="bg"></div>
				<div class="box">
					<div class="tt"><img src="__ASSETS__/turntable/images/tt_bg1.png"></div>
					<div class="txt">很遗憾你没有中奖，再接再厉（我不是一崩崩到底的选手）,你还剩余抽奖 <b><span class="setNum">{{items.times}}</span>次</b> 机会，加油！</div>
				</div>
				<div class="ct"><img src="__ASSETS__/turntable/images/ct.png"></div>
				<div class="bt"><a href="javascript:" class="gg_bt"><img src="__ASSETS__/turntable/images/bt1.png"></a><a href="javascript:" class="close_bt"><img src="__ASSETS__/turntable/images/bt2.png"></a></div>
			</div>


			<div class="div_tan lootery_no1">
				<div class="bg"></div>
				<div class="box">
					<div class="tt"><img src="__ASSETS__/turntable/images/tt_bg.png"></div>
					<div class="txt"><span class="lotteryPre">你上次中了</span>“<b class="lotteryNumber">三等奖</b>”奖品为“<b class="lotteryName">iPhone6s</b>”，请您填写您的信息我们的工作人员将尽快与你取得联系</div>
				</div>
				<div class="ct"><img src="__ASSETS__/turntable/images/ct.png"></div>
				<div class="bt"><a href="javascript:" class="gg_bt"><img src="__ASSETS__/turntable/images/bt1.png"></a><a href="javascript:" class="close_bt"><img src="__ASSETS__/turntable/images/bt2.png"></a></div>
			</div>

			<form class="div_tan lootery_lp js_from" action="/App/AjaxTtable/contact">
				<div class="bg"></div>
				<div class="box">
					<div class="tt"><img src="__ASSETS__/turntable/images/tt_bg.png"></div>
					<div class="txt"><span class="lotteryPre">你上次中了</span>“<b class="lotteryNumber">一等奖</b>”奖品为“<b class="lotteryName">iPhone6s</b>”，请您填写您的信息我们的工作人员将尽快与你取得联系</div>
				</div>
				<div class="ct"><img src="__ASSETS__/turntable/images/ct.png"></div>
				<div class="inupt">
					<span class="js_name"><font>姓名</font><input type="txt" name="name" maxlength="25"/><input type="txt" name="appToken" value="{{appToken_str}}" style="display:none"/></span>
					<span class="js_phone"><font>联系电话</font><input type="txt" name="phone" maxlength="11"/></span>
					<span class="js_address"><font>收获地址</font><input type="txt" name="address" maxlength="25"/></span>
					<span class="js_error"></span>
				</div>
				<div class="bt"><a href="javascript:" class="JS_submit"><img src="__ASSETS__/turntable/images/bt3.png"></a></div>
			</form>

			<div class="share_box">
				<img src="__ASSETS__/turntable/images/share.png" />
			</div>
		</li>
		<li style="height:1px;background:#fef0c9;"></li>
    </ul>
</div>
<script src="__ASSETS__/turntable/js/ai.js" type="text/javascript"></script>
<script src="__ASSETS__/turntable/js/slip-min.js" type="text/javascript"></script>
</body>
</html>